package com.yudaob2b.common.utils;

import java.util.Map;

/**
 * @author kid
 * @email 298023780@qq.com
 * @date 3/16/18 10:55 PM
 */
public class PageUtil {

    public static void setPage(Integer page, Integer pageSize, Map<String, Object> searchMap) {
        //分页
        pageSize = pageSize == null ? 10 : pageSize;
        page = page == null ? 1 : page;
        int offset = 0;
        if (page > 1) {
            offset = pageSize * (page - 1);
        }

        searchMap.put("offset", offset);
        searchMap.put("limit", pageSize);
    }
}
